﻿using Microsoft.AspNetCore.Hosting;

[assembly:HostingStartup(typeof(Demo.Prject02.CunstomHostingStartup))]
namespace Demo.Prject02
{
    public class CunstomHostingStartup : IHostingStartup
    {
        public void Configure(IWebHostBuilder builder)
        {
            Console.WriteLine("CunstomHostingStartup---Configure"); 
            
            //这里不能使用中间件
            //builder.Configure(app =>
            //{
            //    app.Use(middleware: HelloMiddleware);
            //});

        }


        private RequestDelegate HelloMiddleware(RequestDelegate next) => async httpContext =>
        {
            Console.WriteLine("CunstomHostingStartup---启动");
            await next(httpContext);
            Console.WriteLine("CunstomHostingStartup---结束");
        };
    }


}
